package cc.comac.mom.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.EquipFaultDisplayService;
import cc.comac.mom.bean.EquipFaultDisplay;
import cc.comac.mom.bean.ResultDev;
import cc.comac.mom.datahandlers.entity.EquipFaultDisplayDataHandler;
import cc.comac.mom.util.ResultBean;
@Service
@RestController
public class EquipFaultDisplayServiceImpl implements EquipFaultDisplayService {

	@Autowired
	private EquipFaultDisplayDataHandler equipFaultDisplayDataHandler;
	
	
	@Override
	public ResultBean insertFaultDisplay(@RequestBody EquipFaultDisplay EquipFaultDisplay) {
		ResultBean insertFaultDisplay = equipFaultDisplayDataHandler.insertFaultDisplay(EquipFaultDisplay);
		return insertFaultDisplay;
	}

	@Override
	public ResultBean batchDelete(@RequestBody List<EquipFaultDisplay> list) {
		ResultBean batchDelete = equipFaultDisplayDataHandler.batchDelete(list);
		return batchDelete;
	}

	@Override
	public ResultBean updateFaultDisplay(@RequestBody EquipFaultDisplay equipFaultDisplay) {
		ResultBean updateFaultDisplay = equipFaultDisplayDataHandler.updateFaultDisplay(equipFaultDisplay);
		return updateFaultDisplay;
	}

	@Override
	public ResultDev selectBySomeField(@RequestBody EquipFaultDisplay equipFaultDisplay) {
		ResultDev selectBySomeField= null; 
		if (equipFaultDisplay.getSearchAll() != 1) {
			selectBySomeField = equipFaultDisplayDataHandler.selectBySomeField(equipFaultDisplay);
		} else {
			selectBySomeField = equipFaultDisplayDataHandler.selectAll();
		} 
		return selectBySomeField;
	}
}
